﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Cliente/Cliente.Master" AutoEventWireup="true" CodeBehind="ABMUsuarios.aspx.cs" Inherits="Smart_House_System.Cliente.Formulario_web1" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

        <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0">
       
            <cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="Agregar Usuario">
                <ContentTemplate>


                   <table style="width: 100%;"  >
                            <tr>
                                <td style="text-align:right; width:45%;">
                                    Casa
                                </td>
                                <td  style="text-align:left; width:55%">
                                    <select id="cmbCasas" class="styled-select" style="width:300px" runat="server"></select>
                                </td>
                            </tr>
                            <tr>
                                <td style="text-align:right; width:45%;">
                                    Nombre</td>
                                <td  style="text-align:left; width:55%">
                                <asp:TextBox ID="txtNombre" runat="server" CssClass="myText"></asp:TextBox>
                                    &nbsp;  <asp:RequiredFieldValidator ID="rfvNombre" runat="server" 
                                        ControlToValidate="txtNombre" ErrorMessage="*Nombre - Campo obligatorio" ForeColor="Red" Display="None" ></asp:RequiredFieldValidator>
                                    </td>
                            </tr>
                            <tr >
                                <td style="text-align:right; width:45%">
                                    &nbsp;
                                    Apellido</td>
                                <td style="text-align:left; width:55%">
                                    <asp:TextBox ID="txtApellido" runat="server" CssClass="myText"></asp:TextBox>
                                    &nbsp;  <asp:RequiredFieldValidator ID="rfvApellido" runat="server" 
                                        ControlToValidate="txtApellido" ErrorMessage="*Apellido - Campo obligatorio" ForeColor="Red" Display="None"></asp:RequiredFieldValidator>
                                    </td>
                            </tr>
                            <tr >
                                <td style="text-align:right; width:45%">
                                    &nbsp;
                                    Cedula</td>
                                <td style="text-align:left; width:55%">
                                    <asp:TextBox ID="txtCedula" runat="server" CssClass="myText" MaxLength="8"></asp:TextBox>
                                    &nbsp;     <asp:RequiredFieldValidator ID="rfvCedula" runat="server" 
                                        ControlToValidate="txtCedula" ErrorMessage="*Cedula - Campo obligatorio" ForeColor="Red" Display="None"></asp:RequiredFieldValidator>
                                     &nbsp;  
                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"  ControlToValidate="txtCedula" ValidationExpression="^\d+$"
                                        ErrorMessage="El campo debe contener 8 números"  ForeColor="Red" Display="None"></asp:RegularExpressionValidator>
                      
                    
                                </td>
                            </tr>
                            <tr >
                                <td style="text-align:right; width:45%">
                                    &nbsp;
                                    Usuario</td>
                                <td style="text-align:left; width:55%">
                                    <asp:TextBox ID="txtUsuario" runat="server" CssClass="myText"></asp:TextBox>
                                    &nbsp;      <asp:RegularExpressionValidator ID="revUsuario" runat="server"
                                       ErrorMessage="**Usuario - Minimo 8 caracteres."
                                       ControlToValidate="txtUsuario" ForeColor="Red"
                                       ValidationExpression="([a-zA-Z0-9]{8,30})$" Display="None"/>
                                       <asp:RequiredFieldValidator ID="rfvUser" runat="server" 
                                        ControlToValidate="txtUsuario" ErrorMessage="*Usuario - Campo obligatorio" ForeColor="Red" Display="None"></asp:RequiredFieldValidator>
                    
                                </td>
                            </tr>
                            <tr >
                                <td style="text-align:right; width:45%">
                                    &nbsp;
                                    Contraseña</td>
                                <td style="text-align:left; width:55%">
                                    <asp:TextBox ID="txtPassword" runat="server" CssClass="myText" TextMode="Password"></asp:TextBox>
                                    &nbsp;      
                                    <asp:RequiredFieldValidator ID="rfvPassword" runat="server" ControlToValidate="txtPassword" ErrorMessage="*Campo obligatorio" ForeColor="Red" Display="None"></asp:RequiredFieldValidator>
                                                            <asp:RegularExpressionValidator ID="regexpName" runat="server"
                                       ErrorMessage="*Contraseña - Ingresar entre 8 y 20 caracteres, conteniendo al menos un numero y un caracter, no acepta caracteres especiales"
                                       ControlToValidate="txtPassword" ForeColor="Red" 
                                       ValidationExpression="(?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-zA-Z0-9]{8,20})$" Display="None"/>
                                    <asp:RequiredFieldValidator ID="rfvPass" runat="server" ControlToValidate="txtPassword" ErrorMessage="*Contraseña - Campo obligatorio" ForeColor="Red" Display="None"></asp:RequiredFieldValidator>


                                </td>
                            </tr>
                            <tr >
                                <td style="text-align:right; width:45%">
                                    &nbsp;
                                    Rol</td>
                                <td style="text-align:left; width:55%">
                                    <div >
                                        <asp:DropDownList ID="comboRol" CssClass="myText" runat="server">
                                        </asp:DropDownList>
                                    </div>
                                </td>
                            </tr>
                            <tr><td>
                                <asp:Label ID="lblMensaje" runat="server" Font-Size="Larger" ForeColor="Red"></asp:Label>
                                </td>
                            <td>
                                <asp:Button ID="btnAlta" runat="server" onclick="btnAlta_Click" Text="Alta" />&nbsp;<asp:ValidationSummary ID="summary" runat="server" ForeColor="Red"  />
                            </td>
                            </tr>
                        </table>


                </ContentTemplate>
            </cc1:TabPanel>
           
<%--            <cc1:TabPanel ID="TabPanel2" runat="server" HeaderText="Modificar Usuario">
                <ContentTemplate>

                </ContentTemplate>
            </cc1:TabPanel>--%>
                      
            <cc1:TabPanel ID="TabPanel3" runat="server" HeaderText="Listar Usuarios" >
                <ContentTemplate>
                <div style="margin-left:35%"> Casa                
                 <asp:DropDownList ID="cmbCasas2" runat="server" CssClass="styled-select" 
                  style="width:300px" onselectedindexchanged="cmbCasas2_SelectedIndexChanged" AutoPostBack="True"></asp:DropDownList>
                  </div>
                  <br />
            <table border="1" style="margin-left:35%">
                <tr>
                <td class="style1">
                <strong>Cedula</strong>
                </td>
                <td class="style1">
                <strong> Nombre</strong>
                </td>
                <td class="style1">
                <strong>Apellido</strong>
                </td>
                <td class="style1">
                <strong>Rol</strong>
                </td>
                <td class="style1">
                </td>
                </tr>
                 
            <asp:Repeater ID="Repeater1" runat="server">
                <ItemTemplate> 
                    <tr>
                        <td>
                            <%# Eval("Ci") %>
                        </td>
                        <td>
                            <%# Eval("Nombre") %>
                        </td>
                        <td>
                            <%# Eval("Apellido") %>
                        </td>
                        <td>
                            <%# Eval("ElRol")%>
                        </td>    
                        <td>
                            <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("Ci", "updateuser.aspx?Ci={0}")%>'>update</asp:HyperLink>
                        </td>          
                    </tr>
                </ItemTemplate>
            </asp:Repeater> 
        </table>




                </ContentTemplate>
            </cc1:TabPanel>
           
        </cc1:TabContainer>



<cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</cc1:ToolkitScriptManager>

</asp:Content>
